// import './assets/main.css'

import { createApp } from "vue";
import { createPinia } from "pinia";

import App from "./App.vue";
import router from "./router";
import HelloWorld from "./components/HelloWorld.vue";
import Loading from "./components/loading/loading";

import { useResize } from "./hooks";

const app = createApp(App);

// 定义全局函数、变量
app.config.globalProperties.$name = "zy";
app.config.globalProperties.$fn = ()=>{
    return "这是一个全局函数"
};

// 解决页面使用的时候的语法报错问题（红色波浪线）
declare module "@vue/runtime-core" {
    export interface ComponentCustomProperties {
        $fn: ()=>string;
        $name: string;
        $loading: {
            show: ()=>void;
        };
    }
}

// 全局注册组件，直接使用，不需要单独引入了
app.component("HelloWorld", HelloWorld);

app.use(createPinia());
app.use(router);
app.use(useResize)
app.use(Loading)

app.mount("#app");
